package net.m510.autosurfer.smbcvisa;

import net.m510.autosurfer.common.exception.CannotLoginException;
import net.m510.autosurfer.core.DocumentChecker;
import net.m510.autosurfer.core.exception.UserProcessException;

import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;

public class SmbcVisaLoginChecker implements DocumentChecker {
	@Override
	public void check(Document doc) throws UserProcessException {
		if ( doc.getElementById("myPage") != null ) return;
		Elements elems = doc.getElementsByClass("s3");
		if ( elems.size() == 0 ) throw new CannotLoginException("** could not find messeges **");
		throw new CannotLoginException(elems.text());
	}
}